<!DOCTYPE html>
<html>
<head>
    <title></title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList  && !showShlef && !isTest">
        <div class="layui-row">
            <div class="layui-col-xs2">
                <div class="layui-col-xs4 prop">
                    <span>货物名称</span>
                </div>
                <div class="layui-col-xs8 select-content">
                    <i-input v-model="search.goodsName"  />
                </div>
            </div>

             <div class="layui-col-xs3">
                 <div class="layui-col-xs3 prop">
                     <span>所属货位</span>
                 </div>
                 <div class="layui-col-xs9 select-content">

                     <Cascader :data="goodsAreaList"  v-model="search.allocationId"></Cascader>
                 </div>
             </div>
          <!--   <div class="layui-col-xs3">
                 <div class="layui-col-xs3 prop">
                     <span>上架状态</span>
                 </div>
                 <div class="layui-col-xs9 select-content">
                     <el-select v-model="house" placeholder="请选择"  @change="houseChange">
                         <el-option
                                 v-for="item in houseList"
                                 :key="item.id"
                                 :label="item.antennaName"
                                 :value="item.id">
                         </el-option>
                     </el-select>

                 </div>
             </div>-->

            <div class="layui-col-xs5">
                <a class="btn btn-primary" @click="query"><i class="fa fa-search"></i>&nbsp;查询</a>
                <a class="btn btn-primary" @click="reset"><i class="fa fa-refresh"></i>&nbsp;重置</a>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-xs12">
                <#if shiro.hasPermission("goods:bgoods:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
                </#if>
                <#if shiro.hasPermission("goods:bgoods:info")>
                <a class="btn btn-primary" @click="detail"><i class="fa fa-eye"></i>&nbsp;查看</a>
                </#if>
                <#if shiro.hasPermission("goods:bgoods:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
                </#if>
                <#if shiro.hasPermission("goods:bgoods:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
                </#if>
                <a class="btn btn-primary" @click="showShlefList"><i class="fa fa-arrow-circle-up"></i>&nbsp;上架</a>
                <a class="btn btn-primary" @click="unUpShlef"><i class="fa fa-arrow-circle-down"></i>&nbsp;下架</a>
                <a class="btn btn-primary" @click="test"><i class="fa fa-wrench"></i>&nbsp;检测</a>
            </div>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
       <!-- <form class="form-horizontal">
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsName" placeholder="货物名称"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物所属货位</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.allocationId" placeholder="货物所属货位"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">上架</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.isUpshelf" placeholder="货物是否上架，1上架，0未上架"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物单位</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.unitId" placeholder="货物单位"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">所属种类</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsTypeId" placeholder="所属种类"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物图片</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsPic" placeholder="货物图片"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物生产厂家</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsFactory" placeholder="货物生产厂家"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物型号</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsModel" placeholder="货物型号"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物规格</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsSpecs" placeholder="货物规格"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">货物详情</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.goodsDetail" placeholder="货物详情"/>
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-sm-2 control-label">备注</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="bGoods.remark" placeholder="备注"/>
                        </div>
                    </div>
			<div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>-->
        <i-form  class="form-horizontal"  ref= 'bGoods' :model="bGoods"  :rules='ruleValidate' :label-width="100">

            <form-item label="货物名称" prop='goodsName' >
                <i-input  v-model="bGoods.goodsName" :readonly="isShow"  placeholder="请输入货物名称"></i-input>
            </form-item>
            <form-item label="所属货位" prop='allocation' >
               <!-- <i-input  v-model="bGoods.allocationId" disabled  ></i-input>-->
                <Cascader :data="goodsAreaList"  :disabled="isShow"  v-model="bGoods.allocation"></Cascader>
            </form-item>
            <form-item label="编码" prop='labelErp' v-if="title=='详情'" >
                <i-input  v-model="bGoods.labelErp" :readonly="true"  placeholder="编码"></i-input>
            </form-item>
            <form-item label="检验周期" prop='checkTime' v-if="isCheck" >
                <el-input-number v-model="bGoods.checkTime" :min="0" :max="1000" label="天"></el-input-number>  天
            </form-item>
            <form-item label="下次校验时间" prop='dueDate'  v-if="isCheck">
              <!--  <DatePicker type="date" placeholder="下次校验时间"  v-model="bGoods.dueDate"  style="width: 200px"></DatePicker>-->
                <el-date-picker
                        v-model="bGoods.dueDate"
                        type="date"
                        placeholder="下次校验时间">
                </el-date-picker>
            </form-item>
            <form-item label="货物单位" prop='unitId' >
               <!-- <i-input  v-model="bGoods.unitId" :readonly="isShow"  placeholder="请选择货物单位"></i-input>-->
                <el-select v-model="bGoods.unitId"  :disabled="isShow" placeholder="请选择货物单位" @change="selectChange"  style=" width: 100%;">
                    <el-option
                            v-for="item in unitList"
                            :key="item.id"
                            :label="item.antennaName"
                            :value="item.id">
                    </el-option>
                </el-select>
            </form-item>
            <form-item label="所属种类" prop='goodsTypeId' >
                <!--<i-input  v-model="bGoods.goodsTypeId" :readonly="isShow"  placeholder="请选择所属种类"></i-input>-->
                <el-select v-model="bGoods.goodsTypeId"  :disabled="isShow" placeholder="请选择所属种类"  @change="selectChange" style="width: 100%;">
                    <el-option
                            v-for="item in typeList"
                            :key="item.id"
                            :label="item.typeName"
                            :value="item.id">
                    </el-option>
                </el-select>
            </form-item>
            <form-item label="货物图片" prop='goodsPic' >
                <!--<i-input  v-model="bGoods.goodsPic" :readonly="isShow"  placeholder="请输入仓房名称"></i-input>-->
                <el-upload
                        class="avatar-uploader"
                        :action="uploadUrl"
                        :show-file-list="false"
                        :on-success="handleAvatarSuccess"
                        :before-upload="beforeAvatarUpload"  :disabled="isShow">
                    <img v-if="goodsPic" :src="goodsPic" class="avatar">
                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
            </form-item>
            <form-item label="货物生产厂家" prop='goodsFactory' >
                <i-input  v-model="bGoods.goodsFactory" :readonly="isShow"  placeholder="请输入货物生产厂家"></i-input>
            </form-item>
            <form-item label="货物型号" prop='goodsModel' >
                <i-input  v-model="bGoods.goodsModel" :readonly="isShow"  placeholder="请输入货物型号"></i-input>
            </form-item>
            <form-item label="货物规格" prop='goodsSpecs' >
                <i-input  v-model="bGoods.goodsSpecs" :readonly="isShow"  placeholder="请输入货物规格"></i-input>
            </form-item>
            <form-item label="货物详情" prop='goodsDetail' >
                <i-input  v-model="bGoods.goodsDetail" :readonly="isShow"  placeholder="请输入货物详情"></i-input>
            </form-item>
            <form-item label="备注" prop="remark">
                <i-input v-model="bGoods.remark" :readonly="isShow"  type="textarea" v-autosize="{minRows: 2,maxRows: 5}"></i-input>
            </form-item>
            <form-item >
                <i-button type="primary" v-if="title!='详情'" @click="saveOrUpdate('bGoods')"  >确定</i-button>
                <i-button style="margin-left: 8px" @click="reload">返回</i-button>
            </form-item>

        </i-form>
    </div>
    <div v-show="showShlef"  class="panel panel-default">
        <div class="panel-heading">上架</div>
        <div class="" style="padding-top: 10px">
            <div class="layui-row">
                <div>
                    <a class="btn btn-primary" @click="readRFID"><i class="fa"></i>&nbsp;开始读取</a>
                </div>
            </div>
            <div class="layui-row">
            <i-table :columns="columns" :data="bGoodsList"></i-table>
            </div>
            <div class="layui-row">
                <div style="margin: 10px auto;width: 80%;padding-left: 30%;">
                    <a class="btn btn-primary" @click="submit"><i class="fa"></i>&nbsp;上架</a>
                    <a class="btn btn-primary" @click="reback"><i class="fa"></i>&nbsp;取消</a>
                </div>
            </div>
        </div>
    </div>
    <div v-show="isTest"  class="panel panel-default">
    <div class="panel-heading">上架</div>
    <div class="" style="padding-top: 10px">
        <i-form  class="form-horizontal"  ref= 'bGoodsTest' :model="bGoodsTest" :label-width="100">

            <form-item label="货物名称">
                <i-input  v-model="bGoodsTest.goodsName" readonly  placeholder="请输入货物名称"></i-input>
            </form-item>

            <form-item label="检测结果" >
                <!--<i-input  v-model="bGoods.goodsTypeId" :readonly="isShow"  placeholder="请选择所属种类"></i-input>-->
                <el-select v-model="bGoodsTest.type"  :disabled="isShow" placeholder="请选择检测结果"  @change="selectChange" style="width: 100%;">
                    <el-option
                            v-for="item in testList"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id">
                    </el-option>
                </el-select>
            </form-item>

            <form-item label="备注">
                <i-input v-model="bGoodsTest.remark" :readonly="isShow"  type="textarea" v-autosize="{minRows: 2,maxRows: 5}"></i-input>
            </form-item>
            <form-item >
                <i-button type="primary" v-if="title!='详情'" @click="saveTest()"  >确定</i-button>
                <i-button style="margin-left: 8px" @click="reload">返回</i-button>
            </form-item>

        </i-form>
    </div>
</div>
</div>

<script src="${request.contextPath}/statics/js/modules/goods/bgoods.js?_${.now?long}"></script>
</body>
<style>
    .prop{
        padding: 3%;
    }
    .select-content{
        padding: 1%;
    }
    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 178px;
        height: 178px;
        line-height: 178px;
        text-align: center;
    }
    .avatar {
        width: 178px;
        height: 178px;
        display: block;
    }
    input[type='file'] {
        display: none;
    }
</style>
</html>